
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace DAL
{
	public abstract class _Members : SqlClientEntity
	{
		public _Members()
		{
			this.QuerySource = "Members";
			this.MappingName = "Members";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_MembersLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int MemberID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.MemberID, MemberID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_MembersLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter MemberID
			{
				get
				{
					return new SqlParameter("@MemberID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter MemberName
			{
				get
				{
					return new SqlParameter("@MemberName", SqlDbType.NVarChar, 500);
				}
			}
			
			public static SqlParameter MemberTelephone
			{
				get
				{
					return new SqlParameter("@MemberTelephone", SqlDbType.NVarChar, 50);
				}
			}
			
			public static SqlParameter MemberEmail
			{
				get
				{
					return new SqlParameter("@MemberEmail", SqlDbType.NVarChar, 500);
				}
			}
			
			public static SqlParameter MemberImagePath
			{
				get
				{
					return new SqlParameter("@MemberImagePath", SqlDbType.NVarChar, 500);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string MemberID = "MemberID";
            public const string MemberName = "MemberName";
            public const string MemberTelephone = "MemberTelephone";
            public const string MemberEmail = "MemberEmail";
            public const string MemberImagePath = "MemberImagePath";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[MemberID] = _Members.PropertyNames.MemberID;
					ht[MemberName] = _Members.PropertyNames.MemberName;
					ht[MemberTelephone] = _Members.PropertyNames.MemberTelephone;
					ht[MemberEmail] = _Members.PropertyNames.MemberEmail;
					ht[MemberImagePath] = _Members.PropertyNames.MemberImagePath;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string MemberID = "MemberID";
            public const string MemberName = "MemberName";
            public const string MemberTelephone = "MemberTelephone";
            public const string MemberEmail = "MemberEmail";
            public const string MemberImagePath = "MemberImagePath";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[MemberID] = _Members.ColumnNames.MemberID;
					ht[MemberName] = _Members.ColumnNames.MemberName;
					ht[MemberTelephone] = _Members.ColumnNames.MemberTelephone;
					ht[MemberEmail] = _Members.ColumnNames.MemberEmail;
					ht[MemberImagePath] = _Members.ColumnNames.MemberImagePath;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string MemberID = "s_MemberID";
            public const string MemberName = "s_MemberName";
            public const string MemberTelephone = "s_MemberTelephone";
            public const string MemberEmail = "s_MemberEmail";
            public const string MemberImagePath = "s_MemberImagePath";

		}
		#endregion		
		
		#region Properties
	
		public virtual int MemberID
	    {
			get
	        {
				return base.Getint(ColumnNames.MemberID);
			}
			set
	        {
				base.Setint(ColumnNames.MemberID, value);
			}
		}

		public virtual string MemberName
	    {
			get
	        {
				return base.Getstring(ColumnNames.MemberName);
			}
			set
	        {
				base.Setstring(ColumnNames.MemberName, value);
			}
		}

		public virtual string MemberTelephone
	    {
			get
	        {
				return base.Getstring(ColumnNames.MemberTelephone);
			}
			set
	        {
				base.Setstring(ColumnNames.MemberTelephone, value);
			}
		}

		public virtual string MemberEmail
	    {
			get
	        {
				return base.Getstring(ColumnNames.MemberEmail);
			}
			set
	        {
				base.Setstring(ColumnNames.MemberEmail, value);
			}
		}

		public virtual string MemberImagePath
	    {
			get
	        {
				return base.Getstring(ColumnNames.MemberImagePath);
			}
			set
	        {
				base.Setstring(ColumnNames.MemberImagePath, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_MemberID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.MemberID) ? string.Empty : base.GetintAsString(ColumnNames.MemberID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.MemberID);
				else
					this.MemberID = base.SetintAsString(ColumnNames.MemberID, value);
			}
		}

		public virtual string s_MemberName
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.MemberName) ? string.Empty : base.GetstringAsString(ColumnNames.MemberName);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.MemberName);
				else
					this.MemberName = base.SetstringAsString(ColumnNames.MemberName, value);
			}
		}

		public virtual string s_MemberTelephone
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.MemberTelephone) ? string.Empty : base.GetstringAsString(ColumnNames.MemberTelephone);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.MemberTelephone);
				else
					this.MemberTelephone = base.SetstringAsString(ColumnNames.MemberTelephone, value);
			}
		}

		public virtual string s_MemberEmail
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.MemberEmail) ? string.Empty : base.GetstringAsString(ColumnNames.MemberEmail);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.MemberEmail);
				else
					this.MemberEmail = base.SetstringAsString(ColumnNames.MemberEmail, value);
			}
		}

		public virtual string s_MemberImagePath
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.MemberImagePath) ? string.Empty : base.GetstringAsString(ColumnNames.MemberImagePath);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.MemberImagePath);
				else
					this.MemberImagePath = base.SetstringAsString(ColumnNames.MemberImagePath, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter MemberID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.MemberID, Parameters.MemberID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter MemberName
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.MemberName, Parameters.MemberName);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter MemberTelephone
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.MemberTelephone, Parameters.MemberTelephone);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter MemberEmail
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.MemberEmail, Parameters.MemberEmail);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter MemberImagePath
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.MemberImagePath, Parameters.MemberImagePath);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter MemberID
		    {
				get
		        {
					if(_MemberID_W == null)
	        	    {
						_MemberID_W = TearOff.MemberID;
					}
					return _MemberID_W;
				}
			}

			public WhereParameter MemberName
		    {
				get
		        {
					if(_MemberName_W == null)
	        	    {
						_MemberName_W = TearOff.MemberName;
					}
					return _MemberName_W;
				}
			}

			public WhereParameter MemberTelephone
		    {
				get
		        {
					if(_MemberTelephone_W == null)
	        	    {
						_MemberTelephone_W = TearOff.MemberTelephone;
					}
					return _MemberTelephone_W;
				}
			}

			public WhereParameter MemberEmail
		    {
				get
		        {
					if(_MemberEmail_W == null)
	        	    {
						_MemberEmail_W = TearOff.MemberEmail;
					}
					return _MemberEmail_W;
				}
			}

			public WhereParameter MemberImagePath
		    {
				get
		        {
					if(_MemberImagePath_W == null)
	        	    {
						_MemberImagePath_W = TearOff.MemberImagePath;
					}
					return _MemberImagePath_W;
				}
			}

			private WhereParameter _MemberID_W = null;
			private WhereParameter _MemberName_W = null;
			private WhereParameter _MemberTelephone_W = null;
			private WhereParameter _MemberEmail_W = null;
			private WhereParameter _MemberImagePath_W = null;

			public void WhereClauseReset()
			{
				_MemberID_W = null;
				_MemberName_W = null;
				_MemberTelephone_W = null;
				_MemberEmail_W = null;
				_MemberImagePath_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter MemberID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.MemberID, Parameters.MemberID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter MemberName
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.MemberName, Parameters.MemberName);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter MemberTelephone
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.MemberTelephone, Parameters.MemberTelephone);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter MemberEmail
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.MemberEmail, Parameters.MemberEmail);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter MemberImagePath
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.MemberImagePath, Parameters.MemberImagePath);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter MemberID
		    {
				get
		        {
					if(_MemberID_W == null)
	        	    {
						_MemberID_W = TearOff.MemberID;
					}
					return _MemberID_W;
				}
			}

			public AggregateParameter MemberName
		    {
				get
		        {
					if(_MemberName_W == null)
	        	    {
						_MemberName_W = TearOff.MemberName;
					}
					return _MemberName_W;
				}
			}

			public AggregateParameter MemberTelephone
		    {
				get
		        {
					if(_MemberTelephone_W == null)
	        	    {
						_MemberTelephone_W = TearOff.MemberTelephone;
					}
					return _MemberTelephone_W;
				}
			}

			public AggregateParameter MemberEmail
		    {
				get
		        {
					if(_MemberEmail_W == null)
	        	    {
						_MemberEmail_W = TearOff.MemberEmail;
					}
					return _MemberEmail_W;
				}
			}

			public AggregateParameter MemberImagePath
		    {
				get
		        {
					if(_MemberImagePath_W == null)
	        	    {
						_MemberImagePath_W = TearOff.MemberImagePath;
					}
					return _MemberImagePath_W;
				}
			}

			private AggregateParameter _MemberID_W = null;
			private AggregateParameter _MemberName_W = null;
			private AggregateParameter _MemberTelephone_W = null;
			private AggregateParameter _MemberEmail_W = null;
			private AggregateParameter _MemberImagePath_W = null;

			public void AggregateClauseReset()
			{
				_MemberID_W = null;
				_MemberName_W = null;
				_MemberTelephone_W = null;
				_MemberEmail_W = null;
				_MemberImagePath_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_MembersInsert]";
	
			CreateParameters(cmd);
			
			SqlParameter p;
			p = cmd.Parameters[Parameters.MemberID.ParameterName];
			p.Direction = ParameterDirection.Output;
    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_MembersUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_MembersDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.MemberID);
			p.SourceColumn = ColumnNames.MemberID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.MemberID);
			p.SourceColumn = ColumnNames.MemberID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.MemberName);
			p.SourceColumn = ColumnNames.MemberName;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.MemberTelephone);
			p.SourceColumn = ColumnNames.MemberTelephone;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.MemberEmail);
			p.SourceColumn = ColumnNames.MemberEmail;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.MemberImagePath);
			p.SourceColumn = ColumnNames.MemberImagePath;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
